
<%@page import="fu.abc.model.Location"%>
<%@page import="fu.abc.DAO.LocationDAO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	
	<title>Vnplace - Quản lý địa điểm</title>
	
	<!-- CSS -->
	<link href="css/transcreate.css" rel="stylesheet" type="text/css" media="screen" />
	<link rel="stylesheet" type="text/css" href="css/viewlocal.css"/>
    
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
	<script src='jquery.js' type='text/javascript'></script>

	<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>
	<script>
		function initialize() {
			  var mapOptions = {
			    center: new google.maps.LatLng(15.9030623,105.8066925),
			    zoom: 13
			  };
			  var map = new google.maps.Map(document.getElementById('map-canvas'),
			    mapOptions);
	
			  var input = (document.getElementById('address-local'));
// 			  map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
			  var autocomplete = new google.maps.places.Autocomplete(input);
			  autocomplete.bindTo('bounds', map);
	
			  var infowindow = new google.maps.InfoWindow();
			  var marker = new google.maps.Marker({
			    map: map,
			    anchorPoint: new google.maps.Point(0, -29)
			  });
	
			  google.maps.event.addListener(autocomplete, 'place_changed', function() {
			    infowindow.close();
			    marker.setVisible(false);
			    var place = autocomplete.getPlace();
			    if (!place.geometry) {
			      return;
			    }
	
			    // If the place has a geometry, then present it on a map.
			    if (place.geometry.viewport) {
			      map.fitBounds(place.geometry.viewport);
			    } else {
			      map.setCenter(place.geometry.location);
			      map.setZoom(17);  // Why 17? Because it looks good.
			    }
			    /** @type {google.maps.Icon} */
			    marker.setIcon(({
			      url: place.icon,
			      size: new google.maps.Size(71, 71),
			      origin: new google.maps.Point(0, 0),
			      anchor: new google.maps.Point(17, 34),
			      scaledSize: new google.maps.Size(35, 35)
			    }));
			    marker.setPosition(place.geometry.location);
			    marker.setVisible(true);
	
// 			    var address = '';
// 			    if (place.address_components) {
// 			      address = [
// 			        (place.address_components[0] && place.address_components[0].short_name || ''),
// 			        (place.address_components[1] && place.address_components[1].short_name || ''),
// 			        (place.address_components[2] && place.address_components[2].short_name || '')
// 			      ].join(' ');
// 			    }
			  });
	
			  // Sets a listener on a radio button to change the filter type on Places
			  // Autocomplete.
			}
	
		google.maps.event.addDomListener(window, 'load', initialize);
	</script>
	<style>
		.sendmail{
			margin-left: 18px;
			margin-top: 10px;
			height: 30px;
			width: 150px;
		}
	</style>
</head>

<body class="dt-example">
	<div id="wrapper">
		<!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
		<div id="header">
		<%String acc = (String)session.getAttribute("acc"); %>
			<ul id="header-menu">
				<li><p class="logo">Content-Editor</p></li>
				<li>
				<%
	
					if(acc==null){
						response.sendRedirect("/Vnplace/systemAdmin/login.jsp");
					}else{
					
	 			%>
					<p class="hello">
						Chào <b><%=acc %></b>
					</p>
					<%} %>
				</li>
				<li><a href="/Vnplace/content-editor/logout.jsp" class="logout">Đăng xuất</a></li>
			</ul>
		</div>

		<!-- // #end mainNav -->

		<div id="containerHolder">
			<div id="container">
				<div id="sidebar">
					<ul class="sideNav">
						<li><a href="/Vnplace/content-editor/contenteditor.jsp">Trang chủ</a></li>
						<li><a href="/Vnplace/content-editor/manageLocation.jsp">Quản lý địa điểm</a></li>
						<li class="create"><a href="/Vnplace/content-editor/manageCategory.jsp" >Quản lý nhóm địa điểm</a></li>
						<li class="error"><a href="/Vnplace/content-editor/manageerror.jsp" >Quản lý lỗi</a></li>
					</ul>
					<!-- // .sideNav -->
				</div>
				<!-- // #sidebar -->
				<div id="link-home">
					<ul id="link-ul">
						<li><a href="">Trang chủ</a></li>
						<li><img src="/Vnplace/content-editor/image/12.png" width="15px" height="25px" class="home"/></li>
						<li><a href="/Vnplace/content-editor/editLocation.jsp">Địa điểm</a></li>
					</ul>	 
				</div>
				
				<%
					int id = Integer.parseInt(request.getParameter("id"));
					LocationDAO localdao = new LocationDAO();
					Location a = localdao.getLocalForUser(id);
				%>
				
				<div id="main">
<!-- 					<section id="main_content" class="inner"> -->
							<fieldset id="fieldset">
							
								<div class="title">
									<p class="p-title"><%=a.getLocationName() %></p>
								</div>								
								<hr/>
								<h3 style="margin-left: 30px; font-size: 1.3em">Thông tin cơ bản</h3>
								<hr width="900px"/>
									<div id="map-canvas"></div>
									<div id="label-name">
										<label>Tên địa điểm: </label>
										<p class="name-local"><%=a.getLocationName() %></p>
									</div>
								
									<div id="label-category">
										<label>Nhóm địa điểm: </label>
										<p class="cate-local"><%=a.getCategory() %></p>
									</div>
									
									
									<div id="label-address">
										<label>Tỉnh: </label> 
										<p class="province"><%=a.getProvince() %></p>
										<label>Địa điểm chi tiết: </label>
										<p class="address-local"><%=a.getAddressDetail() %></p>
									</div>
									
									<div id="label-phone">
										<label>Số điện thoại:</label>
										<p class="phone"><%=a.getPhone() %></p>
									</div>
									
									<div id="label-web">
										<label>Website:</label>
										<p class="web"><%=a.getWebsite() %></p>
									</div>
									<div id="label-web">
										<label>Email:</label>
										<p class="web"><%=a.getEmail()%></p>
									</div>
									
									<form action="/Vnplace/SendMail" method="post">
										<input type="hidden" name="encode" value="<%=a.getEncode()%>"/>
										<input type="hidden" name="email" value="<%=a.getEmail()%>"/>
										<input type="submit" value="Gửi mail cho người tạo" class="sendmail"/>
									</form>
									
									
									<div id="descript">
										<label>Mô tả chi tiết <span>(*)</span>:</label>
										<p class="descript">
											<%=a.getDescript() %>
										</p>
									</div>
										<hr/>
									<div id="button">
										<ul id="btn-ul">
											<li><input type="button" value="Chỉnh sửa" class="btn-edit" 
												onclick="window.location='editLocation.jsp?id=<%=id%> '"/></li>
											<li><input type="button" value="Hủy" class="btn-can" onclick="window.location='manageLocation.jsp'"/></li>
										</ul>
									</div>
							</fieldset>	
<!-- 					 </section> -->
<!-- 					 end section -->
				</div>
				<!-- // #main -->
				<div class="clear"></div>
			</div>
			<!-- // #container -->
		</div>
		<!-- // #containerHolder -->
		<div id="footer" class="footer">
			<p class="copyright">©Copyright 2014 Vnplace.vn</p>
		</div>
	</div>

	<!-- // #wrapper -->
</body>
</html>
